/**
 * Copyright (c) 2015-2030 by Beijing Yanlight Co., Ltd.
 * All rights reserved.
 */
package com.yanlight.support.alipay.request;

import java.util.Map;

import com.alipay.api.internal.util.AlipaySignature;
import com.alipay.api.internal.util.WebUtils;

/**
 * 
 * @author haolw
 * @time 2017/07/21
 */
public class AlipayNotifyPayRequest {
	private Map<String, String> paramsMap;

	public AlipayNotifyPayRequest(String content) {
		String packets = WebUtils.decode(content);
		this.paramsMap = WebUtils.splitUrlQuery(packets);
	}

	public String getGmtCreate() {
		return paramsMap.get("gmt_create");
	}

	public String getCharset() {
		return paramsMap.get("charset");
	}

	public String getSellerEmail() {
		return paramsMap.get("seller_email");
	}

	public String getSubject() {
		return paramsMap.get("subject");
	}

	public String getSign() {
		return paramsMap.get("sign");
	}

	public String getBody() {
		return paramsMap.get("body");
	}

	public String getBuyerId() {
		return paramsMap.get("buyer_id");
	}

	public String getInvoiceAmount() {
		return paramsMap.get("invoice_amount");
	}

	public String getNotifyId() {
		return paramsMap.get("notify_id");
	}

	public String getFundBillList() {
		return paramsMap.get("fund_bill_list");
	}

	public String getNotifyType() {
		return paramsMap.get("notify_type");
	}

	public String getTradeStatus() {
		return paramsMap.get("trade_status");
	}

	public String getReceiptAmount() {
		return paramsMap.get("receipt_amount");
	}

	public String getAppId() {
		return paramsMap.get("app_id");
	}

	public String getBuyerPayAmount() {
		return paramsMap.get("buyer_pay_amount");
	}

	public String getSignType() {
		return paramsMap.get("sign_type");
	}

	public String getSellerId() {
		return paramsMap.get("seller_id");
	}

	public String getGmtPayment() {
		return paramsMap.get("gmt_payment");
	}

	public String getNotifyTime() {
		return paramsMap.get("notify_time");
	}

	public String getVersion() {
		return paramsMap.get("version");
	}

	public String getOutTradeNo() {
		return paramsMap.get("out_trade_no");
	}

	public String getTotalAmount() {
		return paramsMap.get("total_amount");
	}

	public String getTradeNo() {
		return paramsMap.get("trade_no");
	}

	public String getAuthAppId() {
		return paramsMap.get("auth_app_id");
	}

	public String getBuyerLogonId() {
		return paramsMap.get("buyer_logon_id");
	}

	public String getPointAmount() {
		return paramsMap.get("point_amount");
	}

	public boolean verifySign(String publicKey) {
		try {
			return AlipaySignature.rsaCheckV1(paramsMap, publicKey, getCharset(), getSignType());
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

}
